package com.yaoandw.crawl.threading;

import com.yaoandw.crawl.task.DispatcherTask;

class DispatcherThread extends Thread {

    protected DispatcherTask task;
    protected WorkerThreadPool pool;

    public DispatcherThread(ThreadGroup group, String name, WorkerThreadPool pool) {
        super(group, name);
        this.pool = pool;
    }

    public void assign(DispatcherTask task) {
        this.task = task;
        start();
    }

    public void run() {
        synchronized (task) {
        	task.execute();
        	task.notify();
        }
    }


}
